<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Rollup</title>

<script type="text/javascript">
// introduce some Rollup data to the TestRunner
function setUp() {
    var scriptContent = document.getElementById('rollup-content').innerHTML;
    var container = document.getElementById('script-content-container');
    
    container.appendChild(document.createTextNode(scriptContent));
}
</script>

</head>

<body onload="setUp();">

<table cellpadding="1" cellspacing="1" border="1">
    <tbody>
        <tr>
            <td rowspan="1" colspan="3">Test Rollup<br>
            </td>
        </tr>
        
        <tr>
            <td>addScript</td>
            <td id="script-content-container"></td>
            <td>rollup</td>
        </tr>
        
        <tr>
            <td>open</td>
            <td>../tests/html/test_rollup.html</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>rollup</td>
            <td>cake</td>
            <td></td>
        </tr>
        <tr>
            <td>rollup</td>
            <td>biscuits</td>
            <td>n=1</td>
        </tr>
        <tr>
            <td>verifyNotChecked</td>
            <td>name=one</td>
            <td></td>
        </tr>
        <tr>
            <td>verifyChecked</td>
            <td>name=dos</td>
            <td></td>
        </tr>
        <tr>
            <td>verifyChecked</td>
            <td>name=san</td>
            <td></td>
        </tr>
        <tr>
            <td>rollup</td>
            <td>biscuits</td>
            <td>n=2</td>
        </tr>
        <tr>
            <td>verifyChecked</td>
            <td>name=one</td>
            <td></td>
        </tr>
        <tr>
            <td>verifyNotChecked</td>
            <td>name=dos</td>
            <td></td>
        </tr>
        <tr>
            <td>verifyChecked</td>
            <td>name=san</td>
            <td></td>
        </tr>
        <tr>
            <td>rollup</td>
            <td>biscuits</td>
            <td>n=3</td>
        </tr>
        <tr>
            <td>verifyNotChecked</td>
            <td>name=one</td>
            <td></td>
        </tr>
        <tr>
            <td>verifyChecked</td>
            <td>name=dos</td>
            <td></td>
        </tr>
        <tr>
            <td>verifyNotChecked</td>
            <td>name=san</td>
            <td></td>
        </tr>
        <tr>
            <td>rollup</td>
            <td>steamed spinach</td>
            <td></td>
        </tr>

        <tr>
            <td>removeScript</td>
            <td>rollup</td>
            <td>&nbsp;</td>
        </tr>
    </tbody>
</table>

<pre id="rollup-content">
var rm = new RollupManager();

rm.addRollupRule({
    name: 'cake'
    , description: "Why we're all here"
    , commandMatchers: []
    , expandedCommands: [
          new Command('verifyNotChecked', 'name=one')
        , new Command('verifyNotChecked', 'name=dos')
        , new Command('verifyNotChecked', 'name=san')
        , new Command('click', 'name=san')
        , new Command('click', 'name=dos')
        , new Command('click', 'name=one')
        , new Command('verifyText', 'id=message', 'HAPPY BIRTHDAY!')
    ]
});

rm.addRollupRule({
    name: 'biscuits'
    , description: "The rest of the time"
    , commandMatchers: []
    , getExpandedCommands: function(args) {
        var commands = [];
        if (args.n >= 1) {
            commands.push(new Command('click', 'name=one'));
        }
        if (args.n >= 2) {
            commands.push(new Command('click', 'name=dos'));
        }
        if (args.n >= 3) {
            commands.push(new Command('click', 'name=san'));
        }
        return commands;
    }
});

rm.addRollupRule({
    name: 'steamed spinach'
    , description: "No complaints"
    , commandMatchers: []
    , expandedCommands: [
          new Command('rollup', 'biscuits', 'n=2')
        , new Command('rollup', 'biscuits', 'n=1')
        , new Command('rollup', 'cake')
    ]
});
</pre>

</body>
</html>
